package key.w8.boot.condition;

import key.w8.boot.annotation.EnableK8Reference;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @Author: k8
 * @CreateTime: 2025-08-17
 * @Version: 1.0
 */
public class OnK8ReferenceEnabledCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String[] beanNames = context.getBeanFactory().getBeanNamesForAnnotation(EnableK8Reference.class);
        return beanNames.length > 0;
    }
}
